
/*------------------------------------------------------------------*/

/*------------------------------------------------------------------*/


#ifndef		__PINCFG_H
#define		__PINCFG_H

#include "gd32f20x.h"
#include "gd32f20x_gpio.h"


//------------------------------pin function define---------------------------//



#define Key0Get()         ((~GPIOA->DIR) & (GPIO_PIN_0))
#define Key1Get()         ((~GPIOC->DIR) & (GPIO_PIN_13))
#define Key2Get()         ((~GPIOB->DIR) & (GPIO_PIN_14))

#define Led1On()            GPIOF->BOR = GPIO_PIN_6 
#define Led1Off()           GPIOF->BCR = GPIO_PIN_6
#define Led1St()          ((GPIOF->DOR) & GPIO_PIN_6)

#define Led2On()            GPIOF->BOR = GPIO_PIN_7 
#define Led2Off()           GPIOF->BCR = GPIO_PIN_7
#define Led2St()          ((GPIOF->DOR) & GPIO_PIN_7)

#define Led3On()            GPIOF->BOR = GPIO_PIN_8 
#define Led3Off()           GPIOF->BCR = GPIO_PIN_8
#define Led3St()          ((GPIOF->DOR) & GPIO_PIN_8)

#define Led4On()            GPIOF->BOR = GPIO_PIN_9 
#define Led4Off()           GPIOF->BCR = GPIO_PIN_9
#define Led4St()          ((GPIOF->DOR) & GPIO_PIN_9)

#define NOP1()  __nop()
#define NOP2()  NOP1();NOP1()
#define NOP3()  NOP2();NOP1()
#define NOP4()  NOP3();NOP1()
#define NOP5()  NOP4();NOP1()
#define NOP6()  NOP5();NOP1()
#define NOP7()  NOP6();NOP1()
#define NOP8()  NOP7();NOP1()
#define NOP9()  NOP8();NOP1()
#define NOP10() NOP9();NOP1()
#define NOP11() NOP10();NOP1()
#define NOP12() NOP11();NOP1()
#define NOP13() NOP12();NOP1()
#define NOP14() NOP13();NOP1()
#define NOP15() NOP14();NOP1()
#define NOP16() NOP15();NOP1()
#define NOP17() NOP16();NOP1()
#define NOP18() NOP17();NOP1()
#define NOP19() NOP18();NOP1()
#define NOP20() NOP19();NOP1()
#define NOP21() NOP20();NOP1()
#define NOP22() NOP21();NOP1()
#define NOP23() NOP22();NOP1()
#define NOP24() NOP23();NOP1()
#define NOP25() NOP24();NOP1()
#define NOP26() NOP25();NOP1()
#define NOP27() NOP26();NOP1()
#define NOP28() NOP27();NOP1()
#define NOP29() NOP28();NOP1()
#define NOP30() NOP29();NOP1()
#define NOP31() NOP30();NOP1()
#define NOP32() NOP31();NOP1()
#define NOP33() NOP32();NOP1()
#define NOP34() NOP33();NOP1()
#define NOP35() NOP34();NOP1()
#define NOP36() NOP35();NOP1()
#define NOP37() NOP36();NOP1()
#define NOP38() NOP37();NOP1()
#define NOP39() NOP38();NOP1()
#define NOP40() NOP39();NOP1()
#define NOP(N)  NOP##N()


#endif
